package com.yuanfengPlus.TaskManage.service.impl;

import com.yuanfengPlus.TaskManage.dao.TodoTaskDao;
import com.yuanfengPlus.TaskManage.model.TodoTask;
import com.yuanfengPlus.TaskManage.service.ITaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service

public class ITaskServiceImpl implements ITaskService {
    @Autowired
    private TodoTaskDao todoTaskDao;

    @Override
    public int startTask(TodoTask todoTask) {
        int insert = todoTaskDao.insert(todoTask);
        return insert;
    }

    @Override
    public List<TodoTask> queryTask(String username) {
        List<TodoTask> todoTasks = todoTaskDao.selectByUserName(username);
        return todoTasks;

    }

    @Override
    public int completeTask(String taskId,String userOperation) {
        int update = todoTaskDao.update(taskId, userOperation);
        return update;
    }

}
